﻿@model CustomerReportsModel
@using Telerik.Web.Mvc.UI
@{
    ViewBag.Title = T("Admin.Customers.Reports").Text;
}
<div class="section-header">
    <div class="title">
        <i class="far fa-chart-bar"></i>
        @T("Admin.Customers.Reports")
    </div>
    <div class="options">
    </div>
</div>

@Html.SmartStore().TabStrip().Name("customer-reports").Style(TabsStyle.Material).Items(x =>
{
    x.Add().Text(T("Admin.Customers.Reports.BestBy.BestByOrderTotal").Text).Content(TabBestByOrderTotal()).Selected(true);
    x.Add().Text(T("Admin.Customers.Reports.BestBy.BestByNumberOfOrders").Text).Content(TabBestByNumberOfOrders());
    x.Add().Text(T("Admin.Customers.Reports.RegisteredCustomers").Text).Content(TabRegisteredCustomers());
    
    //generate an event
    EngineContext.Current.Resolve<IEventPublisher>().Publish(new TabStripCreated(x, "customer-reports", this.Html, this.Model));
})

@helper TabBestByOrderTotal()
{
    var dataDictAttributes = new ViewDataDictionary();
    dataDictAttributes.TemplateInfo.HtmlFieldPrefix = "bestbyordertotal";
    @Html.Partial("_ReportBestCustomersByOrderTotal", Model.BestCustomersByOrderTotal, dataDictAttributes)
}

@helper TabBestByNumberOfOrders()
{
    var dataDictAttributes = new ViewDataDictionary();
    dataDictAttributes.TemplateInfo.HtmlFieldPrefix = "bestbynumberoforders";
    @Html.Partial("_ReportBestCustomersByNumberOfOrders", Model.BestCustomersByOrderTotal, dataDictAttributes)
}
@helper TabRegisteredCustomers()
{
    @Html.Action("ReportRegisteredCustomers")
}